Pro-C/C++编译找不到 stddef.h 文件的解决办法

以编译一个 sample 为例,出现找不到 “stddef.h” 文件的错误,如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ proc sample.pc

Pro*C/C++: Release 11.2.0.1.0 - Production on Wed Dec 26 00:40:15 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

System default option values taken from: /usr/local/oracle/product/11.2.0/dbhome_1/precomp/admin/pcscfg.cfg

Error at line 33, column 10 in file /usr/include/stdlib.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Error at line 147, column 10 in file /usr/include/sys/types.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Error at line 25, column 10 in file /usr/include/alloca.h
#include <stddef.h>
.........1

...........

解决办法:

  1. 先确定 stddef.h 在gcc的哪个目录下

    1
    2
    find /usr -name stddef.h 
    /usr/lib/gcc/x86_64-redhat-linux/4.4.4/include/stddef.h
  2. 在 $ORACLE_HOME/precomp/admin/pcscfg.cfg 文件中加入这个目录

    1
    /usr/lib/gcc/x86_64-redhat-linux/4.4.4/include/

然后再编译:
$ proc sample.pc

生成对应的 sample.c 文件,问题解决。